package com.yanyeori.framework.web.http.request.feign.context;

import com.yanyeori.framework.core.util.ThreadLocalUtil;

import java.util.Collection;

/**
 * Feign Header 转换器上下文
 *
 * @author chenkuan
 * @since 2022/7/28
 */
public class HeaderConverterContextHolder {

    private static final ThreadLocal<Collection<Object>> HEADER_CONTEXT_HOLDER = ThreadLocalUtil.create("feignHeaderContext");

    public static Collection<Object> getHeaderContext() {
        return HEADER_CONTEXT_HOLDER.get();
    }

    public static void setHeaderContext(Collection<Object> contexts) {
        HEADER_CONTEXT_HOLDER.set(contexts);
    }

    public static void clear() {
        HEADER_CONTEXT_HOLDER.remove();
    }
}
